[Ocfs2-tools-devel] [PATCH 2/6] Ocfs2-tools: Add utils header to o2info.

Tristan Ye tristan.ye at oracle.com
Mon Nov 23 04:17:54 PST 2009


Prototype definition of utils funcs for o2info.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 o2info/o2info_utils.h |   51 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 o2info/o2info_utils.h

diff --git a/o2info/o2info_utils.h b/o2info/o2info_utils.h
new file mode 100644
index 0000000..177c01a
--- /dev/null
+++ b/o2info/o2info_utils.h
@@ -0,0 +1,51 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * o2info_utils.h
+ *
+ * Common utility function prototypes
+ *
+ * Copyright (C) 2008 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ */
+
+#ifndef __O2INFO_UTILS_H__
+#define __O2INFO_UTILS_H__
+
+#include "o2info.h"
+
+int max_str_len(const char *strs[], int count);
+void fprintf_aligned_space(FILE *out, int max_item_len, const char *item);
+void get_incompat_flag(uint32_t flag, GString *str);
+void get_compat_flag(uint32_t flag, GString *str);
+void get_rocompat_flag(uint32_t flag, GString *str);
+int get_filetype(mode_t st_mode, char **filetype);
+int get_human_permission(mode_t st_mode, uint16_t *perm, char **h_perm);
+int uid2name(uid_t uid, char **uname);
+int gid2name(gid_t gid, char **name);
+struct timespec get_stat_atime(struct stat *st);
+struct timespec get_stat_ctime(struct stat *st);
+struct timespec get_stat_mtime(struct stat *st);
+char *get_human_time(struct timespec t);
+
+errcode_t calc_num_extents(ocfs2_filesys *fs, struct ocfs2_extent_list *el,
+			   uint32_t *ne);
+errcode_t cal_clusters_refcounted(ocfs2_filesys *fs, uint64_t blkno,
+				  int flags, uint32_t *r_clusters);
+
+#endif		/* __O2INFO_UTILS_H__ */
-- 
1.5.5




More information about the Ocfs2-tools-devel mailing list