[Ocfs2-tools-devel] [PATCH 3/7] Ocfs2-tools: Add utils header to o2info.

Tristan Ye tristan.ye at oracle.com
Fri Nov 27 00:53:28 PST 2009


Prototype definition of utils funcs for o2info.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 o2info/o2info_utils.h |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 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..32a3877
--- /dev/null
+++ b/o2info/o2info_utils.h
@@ -0,0 +1,48 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * o2info_utils.h
+ *
+ * Common utility function prototypes
+ *
+ * Copyright (C) 2009 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 version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#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);
+int is_device(const char *path);
+
+errcode_t o2info_open(const char *path, struct o2info_method *om, int flags);
+errcode_t o2info_close(struct o2info_method *om);
+
+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