… | |
… | |
153 | #endif |
153 | #endif |
154 | #ifndef minor |
154 | #ifndef minor |
155 | # define minor(dev) ((dev) & 0xff) |
155 | # define minor(dev) ((dev) & 0xff) |
156 | #endif |
156 | #endif |
157 | |
157 | |
158 | #ifndef PAGESIZE |
158 | #if PAGESIZE <= 0 |
159 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
159 | # define PAGESIZE sysconf (_SC_PAGESIZE) |
160 | #endif |
160 | #endif |
161 | |
161 | |
162 | /*****************************************************************************/ |
162 | /*****************************************************************************/ |
163 | |
163 | |
… | |
… | |
198 | || !fiemap->fm_mapped_extents /* no more extents */ |
198 | || !fiemap->fm_mapped_extents /* no more extents */ |
199 | || fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST /* hit eof */) |
199 | || fiemap->fm_extents [fiemap->fm_mapped_extents - 1].fe_flags & FIEMAP_EXTENT_LAST /* hit eof */) |
200 | goto done; |
200 | goto done; |
201 | |
201 | |
202 | /* else we have to loop - |
202 | /* else we have to loop - |
203 | * it would be tempting (atcually I tried that first) to just query the |
203 | * it would be tempting (actually I tried that first) to just query the |
204 | * number of extents needed, but linux often feels like not returning all |
204 | * number of extents needed, but linux often feels like not returning all |
205 | * extents, without telling us it left any out. this complicates |
205 | * extents, without telling us it left any out. this complicates |
206 | * this quite a bit. |
206 | * this quite a bit. |
207 | */ |
207 | */ |
208 | |
208 | |
… | |
… | |
220 | incmap->fm_flags = fiemap->fm_flags; |
220 | incmap->fm_flags = fiemap->fm_flags; |
221 | incmap->fm_extent_count = (sizeof (scratch) - sizeof (struct fiemap)) / sizeof (struct fiemap_extent); |
221 | incmap->fm_extent_count = (sizeof (scratch) - sizeof (struct fiemap)) / sizeof (struct fiemap_extent); |
222 | |
222 | |
223 | if (ioctl (req->int1, FS_IOC_FIEMAP, incmap) < 0) |
223 | if (ioctl (req->int1, FS_IOC_FIEMAP, incmap) < 0) |
224 | return; |
224 | return; |
|
|
225 | |
|
|
226 | if (!incmap->fm_mapped_extents) |
|
|
227 | goto done; |
225 | |
228 | |
226 | count = fiemap->fm_mapped_extents + incmap->fm_mapped_extents; |
229 | count = fiemap->fm_mapped_extents + incmap->fm_mapped_extents; |
227 | fiemap = realloc (fiemap, sizeof (*fiemap) + sizeof (struct fiemap_extent) * count); |
230 | fiemap = realloc (fiemap, sizeof (*fiemap) + sizeof (struct fiemap_extent) * count); |
228 | errno = ENOMEM; |
231 | errno = ENOMEM; |
229 | if (!fiemap) |
232 | if (!fiemap) |
… | |
… | |
1613 | { |
1616 | { |
1614 | dREQ; |
1617 | dREQ; |
1615 | |
1618 | |
1616 | req->type = EIO_GROUP; |
1619 | req->type = EIO_GROUP; |
1617 | |
1620 | |
|
|
1621 | PUTBACK; |
1618 | req_submit (req); |
1622 | req_submit (req); |
|
|
1623 | SPAGAIN; |
|
|
1624 | |
1619 | XPUSHs (req_sv (req, aio_grp_stash)); |
1625 | XPUSHs (req_sv (req, aio_grp_stash)); |
1620 | } |
1626 | } |
1621 | |
1627 | |
1622 | void |
1628 | void |
1623 | aio_nop (SV *callback=&PL_sv_undef) |
1629 | aio_nop (SV *callback=&PL_sv_undef) |
… | |
… | |
1865 | RETVAL = tee (rfh, wfh, length, flags); |
1871 | RETVAL = tee (rfh, wfh, length, flags); |
1866 | #else |
1872 | #else |
1867 | RETVAL = EIO_ENOSYS (); |
1873 | RETVAL = EIO_ENOSYS (); |
1868 | #endif |
1874 | #endif |
1869 | OUTPUT: |
1875 | OUTPUT: |
|
|
1876 | RETVAL |
|
|
1877 | |
|
|
1878 | int |
|
|
1879 | pipesize (aio_rfd rfh, int new_size = -1) |
|
|
1880 | PROTOTYPE: $;$ |
|
|
1881 | CODE: |
|
|
1882 | #if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ) |
|
|
1883 | if (new_size >= 0) |
|
|
1884 | RETVAL = fcntl (rfh, F_SETPIPE_SZ, new_size); |
|
|
1885 | else |
|
|
1886 | RETVAL = fcntl (rfh, F_GETPIPE_SZ); |
|
|
1887 | #else |
|
|
1888 | errno = ENOSYS; |
|
|
1889 | RETVAL = -1; |
|
|
1890 | #endif |
|
|
1891 | OUTPUT: |
1870 | RETVAL |
1892 | RETVAL |
1871 | |
1893 | |
1872 | void _on_next_submit (SV *cb) |
1894 | void _on_next_submit (SV *cb) |
1873 | CODE: |
1895 | CODE: |
1874 | SvREFCNT_dec (on_next_submit); |
1896 | SvREFCNT_dec (on_next_submit); |