X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fpython%2Fyaffs_importer.py;h=11180ec02c39ecc8836f87fd8912808755e78062;hp=1a6937b921073af5b141860b8b94b3eb6b2cc681;hb=a34826e701dd381a293bb90b25a48d2bd58e8de8;hpb=e3344eda11a9656644f9c7fe345f1283cdd46b20 diff --git a/direct/python/yaffs_importer.py b/direct/python/yaffs_importer.py index 1a6937b..11180ec 100644 --- a/direct/python/yaffs_importer.py +++ b/direct/python/yaffs_importer.py @@ -1,3 +1,16 @@ +## +## YAFFS: Yet Another Flash File System. A NAND-flash specific file system. +## +## Copyright (C) 2002-2010 Aleph One Ltd. +## for Toby Churchill Ltd and Brightstar Engineering +## +## Created by Timothy Manning +## +## 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. +## + import os from yaffsfs import * import sys @@ -353,7 +366,7 @@ def copy_scanned_files_into_yaffs(files_in_snapshot, dir_in_snapshot, symlinks_ debug_message( ("unknown object in snapshot:", unknown_in_snapshot[i]), 0) -def import_into_yaffs(file_path, yaffs_path="/yaffs2/", debug_level=1, copy_hidden_dir=True ,new_yaffs_trace_val=0 ): +def import_into_yaffs(file_path, yaffs_path="/yaffs2/", debug_level=1, copy_hidden_dir=True ,new_yaffs_trace_val=-1 ): # global current_debug_level # global search_hidden_directories # global yaffs_root_dir_path @@ -364,7 +377,8 @@ def import_into_yaffs(file_path, yaffs_path="/yaffs2/", debug_level=1, copy_hid # yaffs_root_dir_path=yaffs_path # path=file_path old_yaffs_trace_val=yaffs_get_trace() - yaffs_set_trace(new_yaffs_trace_val) + if new_yaffs_trace_val!=-1: + yaffs_set_trace(new_yaffs_trace_val) data=scan_dir(file_path, copy_hidden_dir) copy_scanned_files_into_yaffs(data[0], data[1], data[2], data[3],file_path, yaffs_path) @@ -373,14 +387,15 @@ def import_into_yaffs(file_path, yaffs_path="/yaffs2/", debug_level=1, copy_hid if __name__=="__main__": - yaffs_StartUp() + yaffs_start_up() yaffs_mount("/yaffs2/") - yaffs_set_trace(0) + #yaffs_set_trace(0) # absolute_path = os.path.abspath(os.path.curdir) #print "absolute path:", absolute_path current_debug_level=1 search_hidden_directories=True - yaffs_root_dir_path="/yaffs2/scanning/" + yaffs_root_dir_path="/yaffs2/" + yaffs_trace=-1 #print sys.argv path=sys.argv[1] for i in range(2, len(sys.argv)): @@ -388,13 +403,17 @@ if __name__=="__main__": current_debug_level=int( sys.argv[i+1]) if sys.argv[i]=="-ignore_hidden_directories": search_hidden_directories=False + if sys.argv[i]=="-o": + yaffs_root_dir_path=sys.argv[i+1] + if sys.argv[i]=="-yaffs_trace": + yaffs_trace=int(sys.argv[i+1]) # # # path="/home/timothy/work/yaffs/git/yaffs2" # path="/home/timothy/my_stuff/old_laptop/timothy/programming_lejos/" - import_into_yaffs(path, yaffs_root_dir_path, current_debug_level, search_hidden_directories, 0 ) + import_into_yaffs(path, yaffs_root_dir_path, current_debug_level, search_hidden_directories, yaffs_trace ) # scan_dir(path) # copy_scanned_files_into_yaffs() #print_scanned_dir_list()