lkml.org 
[lkml]   [2000]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Return file types from readdir()
    Ulrich Drepper wrote:
    > > You might prefer a new syscall or open() flag to the method I use for
    > > returning the info. If that's the case, ask and I'll write.
    >
    > Please use a new syscall.

    A new syscall would be tidy, preferably one returning the binary layout
    that Glibc returns to apps. Perhaps it should take an extra argument
    like BSD's __readdirx for future whiteout/unionfs support.

    (readdir64 would not be implemented as a syscall -- you don't need 64
    bit dir offsets).

    > Otherwise automatically detecting which method can be used is not that
    > easy.

    It is easy. Look in the new <linux/dirent.h>, at the
    GETDENTS_DIRENT_D_TYPE macro.

    That macro always returns DT_UNKNOWN for dirent records without type
    info. It is binary compatible with older kernels (and indeed the new
    one can return typeless records too).

    So all you have to add to Glibc is:

    user_dirent->d_type = GETDENTS_DIRENT_D_TYPE (kernel_dirent);

    It will just work(tm).

    enjoy,
    -- Jamie

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:56    [W:0.019 / U:30.640 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site