filesys: turn i_ref into a #define
authorAlan Cox <alan@linux.intel.com>
Fri, 22 May 2015 14:38:19 +0000 (15:38 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 22 May 2015 14:38:19 +0000 (15:38 +0100)
This saves us 67 bytes!

Kernel/filesys.c
Kernel/include/kernel.h
Kernel/start.c

index 4ed7b6b..09879f5 100644 (file)
@@ -50,7 +50,7 @@ inoptr kn_open(char *namep, inoptr *parent)
     else
         wd = udata.u_cwd;
 
-    i_ref(ninode = wd);
+    ninode = i_ref(wd);
     i_ref(ninode);
 
     for(;;)
@@ -728,16 +728,6 @@ int8_t uf_alloc(void)
 }
 
 
-
-/* I_ref increases the reference count of the given inode table entry.
-*/
-
-void i_ref(inoptr ino)
-{
-    ino->c_refs++;
-}
-
-
 /* I_deref decreases the reference count of an inode, and frees it from
  * the table if there are no more references to it.  If it also has no
  * links, the inode itself and its blocks(if not a device) is freed.
index 133cf15..ab32dc0 100644 (file)
@@ -681,7 +681,8 @@ extern void oft_deref(int8_t of);
 extern int8_t uf_alloc(void);
 /* returns index of slot, or -1 on failure */
 extern int8_t uf_alloc_n(int n);
-extern void i_ref(inoptr ino);
+#define i_ref(ino) ((ino)->c_refs++, (ino))
+//extern void i_ref(inoptr ino);
 extern void i_deref(inoptr ino);
 extern void wr_inode(inoptr ino);
 extern bool isdevice(inoptr ino);
index ee8f6ee..5085917 100644 (file)
@@ -302,8 +302,8 @@ void fuzix_main(void)
 
        kputs("OK\n");
 
-       i_ref(udata.u_cwd = root);
-       i_ref(udata.u_root = root);
+       udata.u_cwd = i_ref(root);
+       udata.u_root = i_ref(root);
        rdtime32(&udata.u_time);
        exec_or_die();
 }