author | yz157939@agc105 |
Fri, 25 Apr 2008 17:02:23 +0800 | |
changeset 147 | 8c4ef02c14b8 |
permissions | -rw-r--r-- |
147
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
1 |
/* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
2 |
* CDDL HEADER START |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
3 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
7 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
11 |
* and limitations under the License. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
12 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
18 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
19 |
* CDDL HEADER END |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
20 |
*/ |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
21 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
22 |
/* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
23 |
* Copyright 2008 Sun Microsystems, Inc. All rights reserved. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
24 |
* Use is subject to license terms. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
25 |
*/ |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
26 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
27 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
28 |
#ifndef _FSEXAM_LOG_H |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
29 |
#define _FSEXAM_LOG_H |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
30 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
31 |
/* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
32 |
* What is need log and what is not. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
33 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
34 |
* The problem is that when we want to write log/mes info to the |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
35 |
* terminal, we need the fullpath, while the subcoponent of fullpath |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
36 |
* may contain NON-UTF8 characters. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
37 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
38 |
* We can always met with such problem if we have no rights to |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
39 |
* modify filename on the disk, but we can always reduce this kind |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
40 |
* of problem as far as possible. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
41 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
42 |
* So we defer the error msg during constructing tree and handle them |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
43 |
* during convertsion to ensure the path name conatin no non-utf8 name |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
44 |
* as far as possible. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
45 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
46 |
* - File doesn't exist |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
47 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
48 |
* - File Type Not Supported |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
49 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
50 |
* - No History Item: |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
51 |
* Display in log file when there is no history info. |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
52 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
53 |
* ----------------------------------------------------- |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
54 |
* - Symlink target doesn't exist: |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
55 |
* the target file does't exist: get_abs_path_for_symlink_target == NULL |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
56 |
* log when traverse tree and after we convert symlink's filename |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
57 |
* Restore: |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
58 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
59 |
* - UTF-8 already: |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
60 |
* Restore: Don't display such kind of error info, cause it is proper |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
61 |
* behavior |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
62 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
63 |
* - Remote file |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
64 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
65 |
* - Hidden file |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
66 |
* |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
67 |
*/ |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
68 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
69 |
typedef struct _Log_info Log_info; |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
70 |
struct _Log_info { |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
71 |
FILE *fp; |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
72 |
}; |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
73 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
74 |
#define LOG_INFO "(II)" |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
75 |
#define LOG_WARNING "(WW)" |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
76 |
#define LOG_ERROR "(EE)" |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
77 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
78 |
Log_info * fsexam_log_open (const gchar *logfile); |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
79 |
gboolean fsexam_log_puts (Log_info *info, |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
80 |
const gchar *filename, |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
81 |
const gchar *msg); |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
82 |
gboolean fsexam_log_puts_folder_and_name (Log_info *info, |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
83 |
const gchar *dirname, |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
84 |
const gchar *filename, |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
85 |
const gchar *msg); |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
86 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
87 |
void fsexam_log_flush (Log_info *info); |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
88 |
void fsexam_log_close (Log_info *info); |
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
89 |
|
8c4ef02c14b8
replace new version of fsexam, old version 0.3.1 is not used any more
yz157939@agc105
parents:
diff
changeset
|
90 |
#endif //_FSEXAM_LOG_H |