yaffs Further name changes and file reorganisation
[yaffs2.git] / direct / python / yaffs_browser.py
index 626bc78fc6ab9df649b63058032d987bb537506f..effe5a3fd14033652748b8051451ba4ed20b98af 100755 (executable)
@@ -1,10 +1,23 @@
 #!/usr/bin/python 
+##
+## 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 <timothy@yaffs.net>
+##
+## 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 Tkinter as tk
 from yaffsfs import *
 #import examples
 import ctypes
 
-yaffs_StartUp()
+yaffs_start_up()
 yaffs_mount("/yaffs2/")
 root_window =tk.Tk()
 root_window.title("YAFFS Browser")
@@ -88,6 +101,7 @@ class editor():
 def load_dir():
     global current_directory_dict
     print "loading a new directory*******************************************************************"
+    ##deleate current items in text box
     name_list_box.delete(0, tk.END)
     current_directory_dict=yaffs_ls(mount_list_text_variable.get())
     print "new directory", current_directory_dict
@@ -96,13 +110,21 @@ def load_dir():
         name_list_box.insert(x,(current_directory_dict[x]["inodes"]+"  "+ current_directory_dict[x]["type"]+"  "+ current_directory_dict[x]["size"]+"  "+ current_directory_dict[x]["path"]+"  "+current_directory_dict[x]["extra_data"]))
     name_list_box.grid(column=0, row=1)
     return current_directory_dict
-
+    
+def remount_yaffs():
+    ##this isn't working. somethihg need to be changed in the config of the simulator to release the handle of the emfile
+    print "remounting yaffs"
+    print"unmounting yaffs:", yaffs_unmount("yaffs2/")
+    print "mounting yaffs", yaffs_mount("/yaffs2/")
+    load_dir()
+    
 def load_file(link=0):
     global open_windows_list
     open_windows_list.append(editor(link))
 
 def load_command(self=0):
-    global current_directory_dict
+    global current_directory_dictls
+    
     print "you loaded a file/dir/link"
     x=name_list_box.curselection()
     x=int(x[0])
@@ -271,8 +293,6 @@ def delete_selected(selected_dir=0):
             output=yaffs_rmdir(path)
             print "rmdir output:", output
             
-    
-    
     load_dir()
 
 
@@ -478,6 +498,8 @@ browser_menu_bar=tk.Menu(root_window)
 browser_file_menu=tk.Menu(browser_menu_bar)
 
 browser_file_menu.add_command(label="Reload", command=load_dir)
+browser_file_menu.add_command(label="Remount yaffs", command=remount_yaffs)
+
 #browser_file_menu.add_command(label="Open")
 #browser_file_menu.add_command(label="Save")
 browser_menu_bar.add_cascade(label="File", menu=browser_file_menu)