Author: adrian.chadd
Date: Tue Apr 28 00:35:54 2009
New Revision: 13999

Modified:
    branches/LUSCA_HEAD/libsqstore/store_file_ufs.c
    branches/LUSCA_HEAD/libsqstore/store_file_ufs.h

Log:
Break out another UFS/AUFS shared routine - one which checks the given UFS
file belongs in the given directory.



Modified: branches/LUSCA_HEAD/libsqstore/store_file_ufs.c
==============================================================================
--- branches/LUSCA_HEAD/libsqstore/store_file_ufs.c     (original)
+++ branches/LUSCA_HEAD/libsqstore/store_file_ufs.c     Tue Apr 28 00:35:54 2009
@@ -42,3 +42,26 @@
      snprintf(buf, SQUID_MAXPATHLEN, "%s/%02X/%02X", prefix, L1, L2);
      return 1;
  }
+
+/*
+ * F1/F2 - current directory numbers which they're in
+ * L1/L2 - configured storedir L1/L2
+ * fn - file number
+ *
+ * returns whether "fn" belongs in the directory F1/F2 given the  
configured L1/L2
+ */
+int
+store_ufs_filenum_correct_dir(int fn, int F1, int F2, int L1, int L2)
+{
+    int D1, D2;
+    int filn = fn;
+
+    D1 = ((filn / L2) / L2) % L1;
+    if (F1 != D1)
+        return 0;
+    D2 = (filn / L2) % L2;
+    if (F2 != D2)
+        return 0;
+    return 1;
+}
+

Modified: branches/LUSCA_HEAD/libsqstore/store_file_ufs.h
==============================================================================
--- branches/LUSCA_HEAD/libsqstore/store_file_ufs.h     (original)
+++ branches/LUSCA_HEAD/libsqstore/store_file_ufs.h     Tue Apr 28 00:35:54 2009
@@ -3,5 +3,7 @@

  extern int store_ufs_createPath(const char *prefix, int swap_filen, int  
L1, int L2, char *buf);
  extern int store_ufs_createDir(const char *prefix, int L1, int L2, char  
*buf);
+extern int store_ufs_filenum_correct_dir(int fn, int F1, int F2, int L1,  
int L2);
+

  #endif

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to