]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
vmblock: remove pre-2.6.9 compatibility bits from Linux driver
authorVMware, Inc <>
Wed, 24 Feb 2010 22:10:47 +0000 (14:10 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Wed, 24 Feb 2010 22:10:47 +0000 (14:10 -0800)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/modules/linux/vmblock/linux/file.c

index c55ae57ea83abd87a363d2a452ae23de96381c78..d7ac1f634d816b7d09b367709177e777fcd59f27 100644 (file)
 #include "vmblockInt.h"
 #include "filesystem.h"
 
+#if defined(VMW_FILLDIR_2618)
+typedef u64 inode_num_t;
+#else
+typedef ino_t inode_num_t;
+#endif
+
 /* Specifically for our filldir_t callback */
 typedef struct FilldirInfo {
    filldir_t filldir;
    void *dirent;
 } FilldirInfo;
 
-/* File operations */
-static int FileOpOpen(struct inode *inode, struct file *file);
-static int FileOpReaddir(struct file *file, void *dirent, filldir_t filldir);
-static int FileOpRelease(struct inode *inode, struct file *file);
 
-/* Local functions */
-#if defined(VMW_FILLDIR_2618)
-static int Filldir(void *buf, const char *name, int namelen,
-                   loff_t offset, u64 ino, unsigned int d_type);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9)
-static int Filldir(void *buf, const char *name, int namelen,
-                   loff_t offset, ino_t ino, unsigned int d_type);
-#else
-static int Filldir(void *buf, const char *name, int namelen,
-                   off_t offset, ino_t ino, unsigned int d_type);
-#endif
+/*
+ *----------------------------------------------------------------------------
+ *
+ * Filldir --
+ *
+ *    Callback function for readdir that we use in place of the one provided.
+ *    This allows us to specify that each dentry is a symlink, but pass through
+ *    everything else to the original filldir function.
+ *
+ * Results:
+ *    Original filldir's return value.
+ *
+ * Side effects:
+ *    Directory information gets copied to user's buffer.
+ *
+ *----------------------------------------------------------------------------
+ */
 
-struct file_operations RootFileOps = {
-   .readdir = FileOpReaddir,
-   .open    = FileOpOpen,
-   .release = FileOpRelease,
-};
+static int
+Filldir(void *buf,              // IN: Dirent buffer passed from FileOpReaddir
+        const char *name,       // IN: Dirent name
+        int namelen,            // IN: len of dirent's name
+        loff_t offset,          // IN: Offset
+        inode_num_t ino,        // IN: Inode number of dirent
+        unsigned int d_type)    // IN: Type of file
+{
+   FilldirInfo *info = buf;
+
+   /* Specify DT_LNK regardless */
+   return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
+}
 
 
 /* File operations */
@@ -220,56 +236,9 @@ FileOpRelease(struct inode *inode, // IN
 }
 
 
-/* Local functions */
-
-/*
- *----------------------------------------------------------------------------
- *
- * Filldir --
- *
- *    Callback function for readdir that we use in place of the one provided.
- *    This allows us to specify that each dentry is a symlink, but pass through
- *    everything else to the original filldir function.
- *
- * Results:
- *    Original filldir's return value.
- *
- * Side effects:
- *    Directory information gets copied to user's buffer.
- *
- *----------------------------------------------------------------------------
- */
-
-#if defined(VMW_FILLDIR_2618)
-static int
-Filldir(void *buf,              // IN: Dirent buffer passed from FileOpReaddir
-        const char *name,       // IN: Dirent name
-        int namelen,            // IN: len of dirent's name
-        loff_t offset,          // IN: Offset
-        u64 ino,                // IN: Inode number of dirent
-        unsigned int d_type)    // IN: Type of file
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 9)
-static int
-Filldir(void *buf,              // IN: Dirent buffer passed from FileOpReaddir
-        const char *name,       // IN: Dirent name
-        int namelen,            // IN: len of dirent's name
-        loff_t offset,          // IN: Offset
-        ino_t ino,              // IN: Inode number of dirent
-        unsigned int d_type)    // IN: Type of file
-#else
-static int
-Filldir(void *buf,              // IN: Dirent buffer passed from FileOpReaddir
-        const char *name,       // IN: Dirent name
-        int namelen,            // IN: len of dirent's name
-        off_t offset,           // IN: Offset
-        ino_t ino,              // IN: Inode number of dirent
-        unsigned int d_type)    // IN: Type of file
-#endif
-{
-   FilldirInfo *info = (FilldirInfo *)buf;
-
-   /* Specify DT_LNK regardless */
-   return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK);
-}
-
+struct file_operations RootFileOps = {
+   .readdir = FileOpReaddir,
+   .open    = FileOpOpen,
+   .release = FileOpRelease,
+};